package train48days;

import java.util.Scanner;

public class 字符串通配符 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine().toLowerCase();
        String s2 = sc.nextLine().toLowerCase();
        s1 = s1.replaceAll("\\?","[0-9a-z]{1}");
        s1 = s1.replaceAll("\\*{1,}","[0-9a-z]*");
        System.out.println(s2.matches(s1));
    }
}
